import java.net.*;
import java.io.*;

class Cliente{
 public static void main (String[] args){
        DataInputStream input;
        BufferedInputStream bis;
        BufferedOutputStream bos;
        int in;
        byte[] byteArray;
        final String filename = "C:/Users/Grace/Documents/USB/Redes I/Proyecto II/Musica/Lady Antebellum - Ready to love again.mp3";

  try{
            final File localFile = new File( filename );
            Socket client = new Socket("localhost", 1234);
            bis = new BufferedInputStream(new FileInputStream(localFile));
            bos = new BufferedOutputStream(client.getOutputStream());

            //enviamos el nombre del archivo            
            DataOutputStream dos=new DataOutputStream(client.getOutputStream());
            dos.writeUTF(localFile.getName());

            byteArray = new byte[8192];
            while ((in = bis.read(byteArray)) != -1){
                bos.write(byteArray,0,in);
            }

            bis.close();
            bos.close();

        }catch ( Exception e ) {
            System.err.println(e);
        }
    }
}